package com.btm.config;

import com.btm.mcpserver.OrganizationMcpServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class McpServerConfig {

    private static final Logger log = LoggerFactory.getLogger(McpServerConfig.class);

    /**
     * 注册MCP服务
     */
    @Bean
    ToolCallbackProvider toolCallbackProvider(OrganizationMcpServer organizationMcpServer) {
        log.info("ToolCallbackProvider initialized");
        return MethodToolCallbackProvider
                .builder()
                .toolObjects(organizationMcpServer)
                .build();

    }
}
